<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
	<meta http-equiv="Pragma" content="no-cache"></meta>
	<title>Random integers</title>
</head>
<body>
	<h1>Test</h1>
	<script type="text/javascript">
		var MAX_RANDOM_INTEGER = 1005,
			RANDOM_INTEGERS = 10;

		var getRandomInteger = function(max, options) {
			return Math.round(Math.random() * max);
		};
		
		var generateRandomIntegers = function(number, max, options) {
			var i = (number > 0) ? number : 0,
				result = [];
			while (i) {
				result[i] = getRandomInteger(max, options);
				i--;
			}
			return result;
		};
		
		var showResult = function(result) {
			for (var i = 0, lng = result.length; i < lng; i++) {
				console.log(result[i]);
			}
		};
		
		(function() {
			showResult(generateRandomIntegers(RANDOM_INTEGERS, MAX_RANDOM_INTEGER, { integer: true }));
		}());
	</script>
</body>
</html>
